home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c1.zip / FTOC.C < prev    next >
Text File  |  1987-06-18  |  640b  |  23 lines

  1.  
  2.   /* print Fahrenheit-Celsius table
  3.         for f = 0, 20, ..., 300
  4.         (This program is from p. 8 of the Kernighan and Ritchie text)
  5.         */
  6. main()
  7. {
  8.     int lower, upper, step;
  9.     float fahr, celsius;
  10.  
  11.     lower = 0;         /* lower limit of temperature table */
  12.     upper = 300;       /* upper limit */
  13.     step = 20;         /* step size */
  14.  
  15.     fahr = lower;
  16.     while (fahr <= upper) {
  17.         celsius = (5.0/9.0) * (fahr-32.0);
  18.         printf("%4.0f %6.1f\n", fahr, celsius);
  19.         fahr = fahr + step;
  20.     }
  21. }
  22.  
  23.